package com.example.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.example.network.Response;
import com.example.resource.MoneyOut;

public class MoneyOutResponse extends Response {

	public List<MoneyOut> moneyOutList;

	@Override
	protected void jsonToObject() {
		moneyOutList = new ArrayList<MoneyOut>();
		try {
			JSONObject data = reposonJson.getJSONObject("result");
			JSONArray array = data.getJSONArray("infos");
			int size = array.length();
			for (int i = 0; i < size; i++) {
				JSONObject object = array.getJSONObject(i);
				MoneyOut moneyOut = new MoneyOut();
				moneyOut.payTime = object.optString("payTime");
				moneyOut.outBizNo = object.optString("outBizNo");
				moneyOut.amountIn = object.optLong("amountIn");
				moneyOut.bankName = object.optString("bankName");
				moneyOut.status = object.optString("status");
				moneyOut.charge = object.optDouble("charge");
				moneyOut.accountName = object.optString("accountName");
				moneyOut.bankCardNo = object.optString("bankCardNo");
				moneyOutList.add(moneyOut);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

}